package com.qiwenshare.file.domain.dept;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 部门基础信息类
 *
 * @author ma116
 */
@Data
@Table(name = "dept")
@Entity
@TableName("dept")
public class DeptBean {

    @Id
//    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(columnDefinition = "bigint(20)")
    @TableId(type = IdType.AUTO)
    private Long deptId;

    @Column(columnDefinition = "bigint(20) comment '父部门id'")
    private Long parentId;

    @Column(columnDefinition = "varchar(50) comment '祖级列表'")
    private String ancestors;

    @Column(columnDefinition = "varchar(30) comment '部门名称'")
    private String deptName;

    @Column(columnDefinition = "int(4) comment '显示顺序'")
    private Long orderNum;

    @Column(columnDefinition = "varchar(20) comment '负责人'")
    private String leader;

    @Column(columnDefinition = "varchar(11) comment '联系电话'")
    private String phone;

    @Column(columnDefinition = "varchar(30) comment '邮箱'")
    private String email;

    @Column(columnDefinition = "varchar(2) comment '部门状态：0正常/1停用'")
    private String status;

    @Column(columnDefinition = "varchar(2) comment '删除标志：0存在/1删除'")
    private String delFlag;

    @Column(columnDefinition = "varchar(30) comment '创建者'")
    private String createBy;

    @Column(columnDefinition = "datetime comment '创建时间'")
    private Date createTime;

    @Column(columnDefinition = "varchar(30) comment '更新者'")
    private String updateBy;

    @Column(columnDefinition = "datetime comment '更新时间'")
    private Date updateTime;

    @Column(columnDefinition = "bigint(20) comment '钉钉部门id'")
    private Long ddDeptId;

    @Column(columnDefinition = "bigint(20) comment '钉钉父部门id'")
    private Long ddParentId;

    @TableField(exist = false)
    @Transient
    private String parentName;

    /** 子部门 */
    @Transient
    @TableField(exist = false)
    private List<DeptBean> children = new ArrayList<DeptBean>();
}
